memoryblock.htmlHTMLudog…≈πùΔ£πùΔ£ÅÅS[ Monkeybread Realbasic plugin - Documentation - Memoryblock

MBS Plugin Documentation

This is the documentation for the Realbasic Plugins from Monkeybreadsoftware.de. You find these plugins and the newest version of this document at http://www.monkeybreadsoftware.de/realbasic inside the plugins section.

This help was last updated on Freitag, 6. September 2002 and covers 2136 items: 126 classes, 2 controls and 583 global functions.

The list of the themes Global methods by category Global methods by name The list of the classes The list of the controls

class Memoryblock

class, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works partly. Windows: Works.
Function: Extends Realbasic's Memoryblock class.

Address(offset as Integer) as Integer

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Returns the adress of the byte at offset inside the memoryblock.

BytesEqual(srcOfs as Integer, numBytes as Integer, destBlk as MemoryBlock, destOfs as Integer) as Boolean

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Returns true if equal byte data.

CopyBytes(srcOfs as Integer, numBytes as Integer, destBlk as MemoryBlock, destOfs as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Copies the specified amount of bytes into a second MemoryBlock.
Notes: You must make sure that the destination block is large enough to hold the copied bytes (if not, your application or even the whole system can crash).

CopyBytes(srcOfs as Integer, numBytes as Integer, destOfs as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Copies the specified amount of bytes inside the MemoryBlock.
Notes: You must make sure that the copied bytes fit inside the block (if they don't, your application or even the whole system can crash).

CopyBytesFromMacHandle(srcHandle as Integer, numBytes as Integer, destOfs as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: does nothing
Function: Copies bytes from Mac Handle into your memoryblock.
Notes: Same as CopyBytesFromMacPtr, only that the memory address is a so-called Handle (see documentation about the MacOS Memory Manager), which is double-referenced.

CopyBytesFromMacPtr(srcPtr as Integer, numBytes as Integer, destOfs as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: does nothing.
Function: Copies the given amount of bytes from the given address in the Mac's memory address space into the MemoryBlock.
Notes: Make sure that the destination block is large enough to hold the copied bytes (if not, your application or even the whole system can crash).

CopyBytesToMacHandle(srcOfs as Integer, numBytes as Integer, destHandle as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: does nothing
Function: Copies byte data from the memoryblock into the memory the handle is pointing to.
Notes: Same as CopyBytesToMacPtr, only that the memory address is a so-called Handle (see documentation about the MacOS Memory Manager), which is double-referenced.

CopyBytesToMacPtr(srcOfs as Integer, numBytes as Integer, destPtr as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: does nothing
Function: Copies the given amount of bytes from the MemoryBlock to the given address in the Mac's memory address space.
Notes: Be careful where you copy the data to - you can easily crash your computer if you write to the wrong address space.

CRC_32(offset as Integer, numBytes as Integer) as Integer

method, CRC Do, 29. Aug 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Calculates a 32bit Checksum about the provided block of data.
Notes:
See the text "About-CRC" for details about this Checksum things.
This function is also available for strings.

See the CRC_32 for more details on Checksums.

CRC_CCITT(offset as Integer, numBytes as Integer) as Integer

method, CRC Do, 29. Aug 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Calculates a 16bit Checksum about the provided block of data.
Notes:
See the text "About-CRC" for details about this Checksum things.
This function is also available for strings.

See the CRC_32 for more details on Checksums.

CRC_Dillon(bitWidth as Integer, offset as Integer, numBytes as Integer) as String

method, CRC Do, 29. Aug 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Calculates a 16 to 64bit Checksum about the provided block of data.
Notes:
See the text "About-CRC" for details about this Checksum things.
This function is also available for strings.

See the CRC_32 for more details on Checksums.

EndianS16_BtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_BtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS16_BtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_BtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS16_LtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_LtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS16_LtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_LtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS16_NtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_NtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS16_NtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS16_NtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_BtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_BtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_BtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_BtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_LtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_LtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_LtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_LtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_NtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_NtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianS32_NtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianS32_NtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianSwap16(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Swaps several 16 bit integers inside a memoryblock.
Example: n=EndianSwap16(n)

EndianSwap32(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Swaps several 32 bit integers inside a memoryblock.
Example: n=EndianSwap16(n)

EndianU16_BtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_BtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU16_BtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_BtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU16_LtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_LtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU16_LtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_LtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU16_NtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_NtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU16_NtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU16_NtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_BtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_BtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_BtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_BtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_LtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_LtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_LtoN(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_LtoN(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_NtoB(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_NtoB(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

EndianU32_NtoL(offset as integer,count as integer)

method, Endian Mo, 15. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Converts between BigEndian, LowEndian and Native byte encoding.
Example: n=EndianU32_NtoL(n)
Notes:
e.g.:
EndianS32_BtoN(offset as integer,count as integer)
EndianU16_LtoB(offset as integer,count as integer)

Details:
S for signed or U for unsigned.
16 for short and 32 for integer.
B for BigEndian (Mac), L for LowEndian (x86) and N for the native form of the current platform.

Note that count is not the size of the block, but the count of the integers to change.

FindBytes(srcOfs as Integer, maxBytes as Integer, target as MemoryBlock, targOfs as Integer, targLen as Integer) as Integer

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Finds some bytes from the target memoryblock inside the current memoryblock.

FindString(srcOfs as Integer, maxBytes as Integer, target as String) as Integer

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Finds a string inside a memoryblock.

FSSpec(offset as Integer) as FolderItem

property, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: does nothing
Function: Read/Write a FSSpec.
Notes: Interprets 70 bytes starting at the given offset as a FSSpec record.

Int64Str(offset as Integer) as String

property, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Read/Write an 64bit Integer as binary String.
Notes: Interprets 8 bytes starting at the given offset as a 64 bit signed integer value. This method converts the value into a String representing its decimal value.

OSType(offset as Integer) as FolderItem

property, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Read/Write an OSType.
Notes: Interprets 4 bytes starting at the given offset as a OSType value.

SwapBytes(offset as Integer, numBytes as Integer)

method, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Swaps bytes inside the given bounds inside the memoryblock.
Notes: Reverses the order of the bytes at the given offset and length in the MemoryBlock. This is helpful to change representation of values from Little Endian (used in Windows) to Big Endian (used in Mac OS) and vice versa. Thanks to Franco Vaccari for the code of this routine.

ULong(offset as Integer) as Double

property, MemoryBlock Mo, 15. Jul 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Read/Write an unsigned long integer.

Contact

Written 2002 by Christian Schmitz. Feel free to ask or report mistakes to realbasic@macsw.de.
Thanks.

This resource fork intentionally left blank ˇˇ